﻿<UserControl x:Name="AppBrowserGUI"
  x:Class="uhul.XapExplorer"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:ctls="clr-namespace:uhul.Controls"
  xmlns:l="clr-namespace:uhul"
	xmlns:tkt="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  mc:Ignorable="d"
  d:DesignHeight="300" d:DesignWidth="400"
>
  <UserControl.Resources>


    <!--
    template for each tab button
    tab buttons drives app switching
    -->
    <DataTemplate x:Key="ZalozkaAplikace">
      <ctls:TabBtn
        Content="{Binding Label, Mode=TwoWay}"
        Background="{Binding AppInfo.ThemeColor}"
        VerticalAlignment="Top"
        GroupName="AppTabsGroup"
        AppName="{Binding AppInfo.Name}"
        IsChecked="{Binding IsActive, Mode=TwoWay}"
        IsThreeState="False"
        ToolTipService.ToolTip="{Binding AppInfo.Description}"
      />
    </DataTemplate>


    <!--
    stack panel item panel template where tab buttons will render
    -->
    <ItemsPanelTemplate x:Key="PanelZalozekAplikaci">
      <StackPanel
        Orientation="Horizontal" Margin="0"
			/>
    </ItemsPanelTemplate>



    <!--
    sablona pro vykresleni jednotlivych zalozek/tlacitek
    pro prepinani mezi aplikacemi
    -->
    <DataTemplate x:Key="OknoAplikace">
      <Grid
        Margin="0"
      />
    </DataTemplate>
    <!--IsChecked="{Binding IsActive, Mode=TwoWay}"-->


  </UserControl.Resources>

  <tkt:BusyIndicator x:Name="AppIsBusy" IsBusy="False">
    
    <Grid x:Name="WhiteBackground" Opacity="1" Background="#ffffffff">

      <Grid x:Name="OverlayPicture">
        <Grid.Background>
          <ImageBrush x:Name="backgroundImageBrush"
							  Opacity=".7" Stretch="UniformToFill"
							  ImageSource="http://img2.flog.pravda.sk/2009/02/04/vcr_173251_m.jpg"
				  />
        </Grid.Background>

        <Grid x:Name="AppLayout" Visibility="Collapsed" Opacity="1">
          <Grid>
            <Grid.RowDefinitions>
              <RowDefinition Height="31"/>
              <RowDefinition Height="*" MinHeight="150"/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
              <ColumnDefinition Width="52"/>
              <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <!--<Border Grid.Column="0" Grid.Row="0" Background="#ffffffff" CornerRadius="50,50,0,0"/>-->
            <Border Grid.Column="0" Grid.Row="0" Margin="0" VerticalAlignment="Bottom" Height="6" Background="#fff0f0f0"/>

            <Grid x:Name="AppTabContainer"
              Grid.Column="1" Grid.Row="0" Background="#50404040" Margin="0"
            >
             
              <!--
              this is container control for tab buttons that allows switch between apps
              -->
              <ItemsControl x:Name="KontejnerZalozek" Margin="0"
                ItemsSource="{Binding RunningApplications, ElementName=AppBrowserGUI}"
                HorizontalAlignment="Left"
                VerticalAlignment="Top"
                ItemTemplate="{StaticResource ZalozkaAplikace}"
                ItemsPanel="{StaticResource PanelZalozekAplikaci}"
              />

              <Border Margin="0" VerticalAlignment="Bottom" Height="6" Background="#fff0f0f0"/>

            </Grid>

            <Grid x:Name="AppViewPort" Margin="0"
              Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2"
              SizeChanged="AppViewPort_sizeChanged"
            >
              <!--here comes app GUI for each running app-->
              <StackPanel Grid.Column="1" Grid.Row="1" Margin="0"/>

            </Grid>

          </Grid>

          <!--tlacitko pro prechod do seznamu aplikaci-->
          <ctls:AppButon
            x:Name="AppRunBtn"
            Click="showAppMenu" 
            Height="50" Width="50"
            VerticalAlignment="Top"
            HorizontalAlignment="Left"
            Margin="0"
          />
        </Grid>
        <!--app menu view-->
        <Grid x:Name="NabidkaAplikaci" Opacity="1" Visibility="Visible">
          <ctls:AppMenu x:Name="SeznamAplikaci"  Margin="0"/>
          <Button 
            Content="&lt;-"
            Height="50" Width="50"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"  
            Click="showApps" Style="{StaticResource BackButtonStyle}"
          />
        </Grid>

      </Grid><!--OverlayPicture-->
    </Grid><!--WhiteBackground-->
  </tkt:BusyIndicator>
</UserControl>
